import { defineConfig, presetAttributify, presetIcons, presetWind4 } from 'unocss'

import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'

export default defineConfig({
  presets: [
    presetWind4(),
    presetAttributify({
      prefixedOnly: true,
    }),
    presetIcons({
      scale: 1.2,
      warn: true,
      extraProperties: {
        display: 'inline-block',
        'vertical-align': 'middle',
      },
      collections: {
        // 本地图标库 my-文件名称
        icons: FileSystemIconLoader('./src/assets/icons', (svg) => svg.replace(/#fff/, 'red')),
      },
    }),
  ],
  shortcuts: [
    ['flex-center', 'flex justify-center items-center'],
    ['flex-col', 'flex flex-col'],
    ['card-border', 'border border-solid'],
    ['card', 'card-border p-2 rounded-lg bg-white'],
    [
      'button',
      'px-4 py-1 rounded inline-block bg-teal-600 text-white cursor-pointer hover:bg-teal-700 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50',
    ],
  ],
})
